//
//  ViewController.m
//  06-Homework
//
//  Created by dllo on 16/7/21.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.110 green:0.659 blue:0.949 alpha:1.000];
    UISegmentedControl *seg = [[UISegmentedControl alloc] initWithItems:@[@"消息", @"电话"]];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    seg.frame = CGRectMake(0, 0, 80, 30);
    self.navigationItem.titleView = seg;
    
    UIButton *headButton = [UIButton buttonWithType:UIButtonTypeCustom];
    headButton.frame = CGRectMake(0, 0, 40, 40);
    [headButton setImage:[UIImage imageNamed:@"4"] forState:UIControlStateNormal];
    headButton.layer.cornerRadius = 20;
    [headButton.layer setMasksToBounds:YES];
    [headButton addTarget:self action:@selector(headButtonDidClicked:) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithCustomView:headButton];
    self.navigationItem.leftBarButtonItem = barButton;
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(rightBarButtonItemClicked:)];
}

- (void)headButtonDidClicked:(UIButton *)button {
    
}

- (void)rightBarButtonItemClicked:(UIBarButtonItem *)barButton {
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
